package com.hyh.shiyanshiguanli.controller;

import com.hyh.shiyanshiguanli.domain.dto.LibAddDTO;
import com.hyh.shiyanshiguanli.domain.dto.PageDTO;
import com.hyh.shiyanshiguanli.domain.dto.StorageAddDTO;
import com.hyh.shiyanshiguanli.domain.result.PageResult;
import com.hyh.shiyanshiguanli.domain.result.Result;
import com.hyh.shiyanshiguanli.service.StorageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author hyh
 * @version 1.0
 */
@RestController
@Slf4j
@RequestMapping("/storage")
public class StorageController {

    @Autowired
    StorageService storageService;

    @GetMapping("/page")
    public Result<PageResult> page(PageDTO pageDTO){
        log.info("入库查询{}",pageDTO);

        PageResult result = storageService.page(pageDTO);

        return Result.success(result);
    }
    @PostMapping("/addStorage")
    public Result addStorage(@RequestBody StorageAddDTO storageAddDTO){
        log.info("添加storageAddDTO{}",storageAddDTO);
        storageService.add(storageAddDTO);
        return Result.success();
    }


}
